<template>
    <div class="card">
        <!-- {{this.cardData}} -->
        <div class="block">
            <div v-if="this.cardData == ''" class="noEquipment"> 
                该项绑定设备未开启
            </div>
            <el-carousel trigger="click" class="card_hight" :autoplay="false" :initial-index="cardData.index" >
            <el-carousel-item v-for="item in cardData.unit" :key="item.index">
                <!-- 设备标题 -->
                <router-link to="/overview">
                    <h4 class="normal" @click="router('mouse',item)" :title="item.name">
                    <!-- <svg class="icon card_icon" aria-hidden="true">
                        <use xlink:href="#icon-xinfeng-copy"></use>
                    </svg> -->
                    <img class="title_icon" src="../../assets/title.png" alt />
                    {{item.typename}}:{{item.name}}
                 </h4>
                </router-link>
                <!-- 卡片内容 -->
                <div class="card_padding">
                    <div class="mouse_top">
                        <div class="top">
                            <div class="top_left" v-if="item.unit[0].ready == 1">
                                <span>{{item.unit[0].name}}:</span>
                                <span class="tl_value">{{item.unit[0].value.toFixed(0)}}</span>
                                <span class="tl_flag">{{item.unit[0].flag}}</span>
                            </div>
                            <div class="top_left" v-if="item.unit[1].ready == 1">
                                <span>{{item.unit[1].name}}:</span>
                                <span class="tl_value">{{item.unit[1].value.toFixed(0)}}</span>
                                <span class="tl_flag">{{item.unit[1].flag}}</span>
                            </div>
                        </div>
                        <div class="top">
                            <div class="top_left" v-if="item.unit[2].ready == 1">
                                <span>{{item.unit[2].name}}:</span>
                                <span class="tl_value">{{item.unit[2].value.toFixed(0)}}</span>
                                <span class="tl_flag">{{item.unit[2].flag}}</span>
                            </div>
                            <div class="top_left" v-if="item.unit[3].ready == 1">
                                <span>{{item.unit[3].name}}:</span>
                                <span class="tl_value">{{item.unit[3].value.toFixed(0)}}</span>
                                <span class="tl_flag">{{item.unit[3].flag}}</span>
                            </div>
                        </div>
                    </div>
                    
                    <div style="clear:both"></div>
                    <div class="bottom">        
                        <div v-if="item.unit[6].ready == 1">
                            <p class="p1">{{item.unit[6].value == 0 ? '关机' : '开机'}}</p>
                            <h4>状态</h4>
                        </div>
                        <div v-if="item.unit[4].ready == 1">
                            <p class="p1" v-if="item.unit[4].value == 0">快速</p>
                            <p class="p1" v-if="item.unit[4].value == 1">离散</p>
                            <p class="p1" v-if="item.unit[4].value == 2">普通</p>
                            <h4>模式</h4>
                        </div>
                        <div v-if="item.unit[5].ready == 1">
                            <p class="p1" v-if="item.unit[5].value == 0">全向</p>
                            <p class="p1" v-if="item.unit[5].value == 1">交错</p>
                            <p class="p1" v-if="item.unit[5].value == 2">旋转</p>
                            <h4>场景</h4>
                        </div>
                    </div>
                </div>
                 
            </el-carousel-item>
            </el-carousel>
        </div>
        
    </div>
</template>

<script>
export default {
    props: ['nowIndex', 'cardData', 'nowId'],
    data () {
        return{
        }
    },
    created() {
    },
    methods: {
        // 跳转
        router(val,item){
            var arr = {
                addr:item.addr,
                name:item.name,
                type:item.type,
                uid:item.uid
            }
            localStorage.setItem("当前设备编号", JSON.stringify(arr))
            localStorage.setItem("menuRouter", val)
        },
    },
     // 清除定时器
    beforeDestroy() {
    },
}
</script>

<style scoped>

/deep/ .el-carousel__container .el-carousel__arrow {
    height: 150px !important;
    width: 110px !important;
    border-radius: 0;
    background: none;
}
/deep/ .el-icon-arrow-left {
    margin-left: -110px !important;
}
/deep/ .el-icon-arrow-right{
    margin-right: -110px !important;
}
/deep/ .el-carousel__indicators{
    display: none;
}
.card_padding .item{
    width: 100%;
    height: 25px;
    float: left;
    /* text-align: center; */
    font-size: 18px;
    margin: 12px 0;
}
.normal .card_icon{
    font-size: 20px;
}
.li{
    display: flex;
    margin-bottom: 3px;
}
/deep/ .progress_title {
    /* display: inline-block; */
    width: 130px;
    line-height: 24px;
    float: left;
    /* flex: 1; */
    font-size: 16px;

}
/deep/ .el-progress{
    padding: 4px 0;
    width: 300px;
    /* flex: 1; */
}
.progress_value{
    float: right;
    /* flex: 1; */
    text-indent: 20px;
    width: 130px;
    line-height: 26px;
    height: 30px;

}
/deep/ .el-progress-bar__outer{
    background: none;
    border: .5px solid rgba(89, 129, 165, 0.8);
}
/deep/ .li:nth-child(1) .el-progress-bar__inner{
    background: #328be8;
}
/deep/ .li:nth-child(2) .el-progress-bar__inner{
    background: #60b1e2;
}
/deep/ .li:nth-child(3) .el-progress-bar__inner{
    background: #328be8;
}
/deep/ .li:nth-child(4) .el-progress-bar__inner{
    background: #60b1e2;
}
/deep/ .card_padding {
    padding: 0px 20px 0px 30px !important;
}
.bottom{
    display: flex;
    margin-top: 22px;
    text-indent: 30px;
}
.bottom>div{
    flex: 1;
}
.bottom p{
    font-size: 34px;
    font-weight: 500;
    text-align: center;
    line-height: 40px;
    text-indent: 0px;
}
.bottom .p1{
    color: #0168b7;
    font-size: 22px;
    text-align: center;
    text-indent: 0px;
} 
.bottom p span{
    font-size: 16px;
    margin-left: 5px;
    color: #fff;
}
.bottom  h4{
    font-weight: 400;
    text-indent: 0px;
    text-align: center;
}
.top{
    margin-left: 20px;
    display: flex;
}
.top_left{
    flex: 1;
    height: 55px;
    line-height: 70px;
    overflow: hidden;
}
.tl_value{
    color: #38bdea;
    font-size: 24px;
    padding-left: 10px;
    padding-right: 5px;
    position: relative;
    top: 1px;
}
.mouse_top{
    /* height: 49px; */
    /* line-height: 60px; */
    border-bottom:5px solid;
    /* border-top:5px solid; */
    /* border-top:5px solid #8fc6ffa3;
    border-bottom:5px solid #8fc6ffa3; */
    border-image: linear-gradient(to bottom , #fff0, #8fc6ffa3)100 0;
    background: linear-gradient(to bottom , rgba(255, 0, 0, 0), #8fc6ffa3 300%);
}
</style>